# -*- coding: utf-8 -*-
"""
@Time ： 2023/4/15 21:25
@Auth ： 叶东宇
@File ：twoSum.py
"""
def twoSum(li, target):
    length = len(li)
    for i in range(0, length):
        for j in range(i+1, length):
            if li[i]+li[j] == target:
                return [i, j]
    return

def t():
    dic = {"5": 0, "4": 1}
    print(0 in dic.values())
    print(type(dic.values()))

def from_leetcode(li, target):
    dic = dict()
    for i in range(len(li)):
        ## 查找的时间复杂度为O(1),并且采用target-li[i]的方式只需要遍历一遍
        if target - li[i] not in dic:
            dic[li[i]] = i
        else:
            return [dic[target - li[i]], i]
    return


if __name__ == "__main__":
    t()
    lis = [2,3,6,1,8,6,7]
    target = 3
    print(twoSum(lis, target))